package cn.oschina.service.impl;

import cn.oschina.entity.UserEntity;
import cn.oschina.mapper.*;
import cn.oschina.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

/**
 * @Describe
 * @Author lin
 * @create 2025/2/12 14:38
 */
 
/**
 * @Describe
 * @Author lin
 * @create 2025/2/12 14:38
 */
@Service
@Primary
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    User01Mapper user01Mapper;

    @Override
    public UserEntity getUserById(Long id) {
        return userMapper.getUserById(id);
    }

    @Override
    public UserEntity getUserById2(int id) {
        return null;
    }

    @Override
    public UserEntity getUserById(boolean id, String a) {
        return null;
    }

    //重载
    public UserEntity getUserById() {
        return getUserById(1L);
    }

    public UserEntity getUser01ById(Long id) {
        //循环调用演示
        xunHuan01();
        return user01Mapper.getUser01ById(id);
    }

    public void xunHuan01() {
        xunHuan02();
    }

    public void xunHuan02() {
        xunHuan03();
    }

    public void xunHuan03() {
        xunHuan01();
    }

    //调用自己递归
    public void callRecursion() {
        callRecursion();
        user01Mapper.getUser01ById(1L);
    }
}
